package com.hkemmm.service.impl;

import com.hkemmm.bean.UserInfoBean;
import com.hkemmm.dao.UserInfoBeanMapper;
import com.hkemmm.service.IUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class UserServiceImpl implements IUserService {

    // 依赖注入
    @Resource
    private UserInfoBeanMapper userInfoBeanMapper;

    @Override
    public boolean doLogin(UserInfoBean userInfoBean) {
        UserInfoBean userInfoBean1 = userInfoBeanMapper.doLogin(userInfoBean);
        //System.out.println("mybatis查询结果：" + userInfoBean1);
        return userInfoBean1 != null;
    }

    @Override
    public int addAndUpdateUserInfo(UserInfoBean userInfoBean) {
        int i = userInfoBeanMapper.insertSelective(userInfoBean);

        return i;
    }

    @Override
    public List<UserInfoBean> selectALL() {
        return userInfoBeanMapper.selectALL();
    }

    @Override
    public UserInfoBean selectByPrimaryKey(Integer userid) {
        return userInfoBeanMapper.selectByPrimaryKey(userid);
    }

    @Override
    public List<UserInfoBean> selectByPrimary(UserInfoBean userInfoBean, Date userregdate2) {
        return userInfoBeanMapper.selectByPrimary(userInfoBean,userregdate2);
    }


    public void setUserInfoBeanMapper(UserInfoBeanMapper userInfoBeanMapper) {
        this.userInfoBeanMapper = userInfoBeanMapper;
    }
}
